<?php
include_once("config.php");
session_start();
//include('lock_admin.php');

$response = array();

if(isset($_POST) && isset($_POST["artistname"]))
{
  $count = ArtistQuery::create()
    ->filterByNom($_POST["artistname"])
    ->count();
  if($count == 0)
  {
    $artist = new Artist();
    $artist->setNom($_POST["artistname"]);
    $artist->setInfo($_POST["info"]);
    $artist->setImgUrl($_POST["img"]);
    $artist->save();
    $response["succes"] = true;
  }
  else
  {
    $response["succes"] = false;
    $response["msg"] = "Artist deja registre";
  }
}else{
  $response["succes"] = false;
  $response["msg"] = "No post info";
}

die(json_encode($response));

?>
